#!/usr/bin/env python
# -*- coding:utf-8 -*-

# file:homework6_3.py
# author:wmf
# datetime:2021/4/16 23:46
# software: PyCharm
'''
this is function description
'''


# import module your need

# 三、定义一个字典类：dictclass。完成下面的功能：
# dict = dictclass({你需要操作的字典对象})
# 1 删除某个key
# del_dict(key)
# 2 判断某个键是否在字典里，如果在返回键对应的值，不存在则返回"not found"
# get_dict(key)
# 3 返回键组成的列表：返回类型;(list)
# get_key()
# 4 合并字典，并且返回合并后字典的values组成的列表。返回类型:(list)
# update_dict({要合并的字典})


class dict_class:

    def __init__(self, **the_dict):
        self.the_dict = {}
        for k,v in the_dict.items():
            self.the_dict[k] = v

    def del_dict(self, key):
        if key in self.the_dict:
            self.the_dict.pop(key)

    def get_dict(self, key):
        if key in self.the_dict:
            return self.the_dict[key]
        else:
            return "not found"

    def get_key(self):
        list1 = self.the_dict.keys()
        return list1

    def update_dict(self, **the_dict):
        dict2 = {}
        for k,v in the_dict.items():
            dict2[k] = v
        self.the_dict.update(dict2)
        print(self.the_dict)
        list1 = [self.the_dict.values()]
        return list1

    def show_dict(self):
        print(self.the_dict)

print("实例化dict_class对象")
dict1 = dict_class(Name="Runoob",Age=7,Sex="男",Hobby="play")
dict1.show_dict()
print("执行del_dict操作")
dict1.del_dict("Hobby")
dict1.show_dict()
print("执行get_dict操作")
print(dict1.get_dict("Name"))
print(dict1.get_dict("语文"))
print("执行get_key操作")
print(dict1.get_key())
print("执行update_dict操作")
print(dict1.update_dict(Chinese=86,Math=91,English=90))